import React, { useEffect, useState } from 'react';
import { connect } from 'umi';
import { Form, Button, Col, Row, Popover } from 'antd';
import TableDataBlock from '@/components/TableDataBlock';
const ShowTable = (props) => {
  const { list, setList } = props
  const getColumns = [
    {
      title: '标题',
      dataIndex: 'title',
    },
    {
      title: '是否允许充分',
      dataIndex: 'repeatFlag',
      render: (e) => {
        return {
          0: '不允许',
          1: '允许'
        }[e]
      }
    },
    {
      title: '采集数量',
      dataIndex: 'recordAmount',
    },
    {
      type: 'handle',
      width: 200,
      dataIndex: 'id',
      render: (val, record) => [
        {
          title: '删除',
          click: () => {
            setList(list.filter(item => {
              return item.id !== record.id
            }))

          },
        },
      ]
    }
  ];
  return <TableDataBlock
    columns={getColumns}
    rowKey={(record) => `${record.id}`}
    list={list}
  ></TableDataBlock>
}
export default connect(({ loading }) => ({}))(ShowTable);